<template>
	<view class="u-page">
		<!-- <view class="box-bg">
			<uni-nav-bar :fixed='true' left-icon="left" :border="false" @clickLeft='handleBack' title="单位详情"
				height="65px" color="#fff" backgroundColor="#7CAFE7" />
		</view> -->
		<nav-bar title="单位详情"></nav-bar>
		<view class="u-page__item">
			<uni-list>
				<uni-list-item>
					<template v-slot:header>
						<text class="slot-box slot-title">单位名称</text>
					</template>
					<template v-slot:footer>
						<text class="slot-content">{{ unitObject.companyname }}</text>
					</template>
				</uni-list-item>
				<uni-list-item>
					<template v-slot:header>
						<text class="slot-box slot-title">隶属类型</text>
					</template>
					<template v-slot:footer>
						<text class="slot-content">{{ unitObject.companytypetext}}</text>
					</template>
				</uni-list-item>
				<uni-list-item>
					<template v-slot:header>
						<text class="slot-box slot-title">所属地区</text>
					</template>
					<template v-slot:footer>
						<text class="slot-content">{{unitObject.province}}{{unitObject.city}}{{unitObject.area}}</text>
					</template>
				</uni-list-item>
				<uni-list-item>
					<template v-slot:header>
						<text class="slot-box slot-title">单位地址</text>
					</template>
					<template v-slot:footer>
						<text class="slot-content">{{unitObject.companyaddress}}</text>
					</template>
				</uni-list-item>
				<uni-list-item>
					<template v-slot:header>
						<text class="slot-box slot-title">联系人姓名</text>
					</template>
					<template v-slot:footer>
						<text class="slot-content">{{unitObject.companymanname}}</text>
					</template>
				</uni-list-item>
				<uni-list-item>
					<template v-slot:header>
						<text class="slot-box slot-title">联系人电话</text>
					</template>
					<template v-slot:footer>
						<text class="slot-content">{{unitObject.companymantel}}</text>
					</template>
				</uni-list-item>
				<uni-list-item>
					<template v-slot:header>
						<text class="slot-box slot-title">单位备注</text>
					</template>
					<template v-slot:footer>
						<text class="slot-content">{{unitObject.companymark}}</text>
					</template>
				</uni-list-item>
				<uni-list-item>
					<template v-slot:header>
						<text class="slot-box slot-title">单位状态</text>
					</template>
					<template v-slot:footer>
						<text class="slot-content">{{ statusStr(unitObject.isdelete)}}</text>
					</template>
				</uni-list-item>
				<uni-list-item>
					<template v-slot:header>
						<text class="slot-box slot-title">停用/启用说明</text>
					</template>
					<template v-slot:footer>
						<text class="slot-content">{{unitObject.disableMark}}</text>
					</template>
				</uni-list-item>
			</uni-list>
		</view>
	</view>
</template>

<script setup>
	import {
		ref,
		reactive
	} from 'vue'
	import {
		onLoad,
		onShow
	} from '@dcloudio/uni-app'
import NavBar from '@/components/NavBar.vue';
import {getCompanyListDetail} from '@/api/use.js'
	const unitId = ref('')
	const unitObject = ref({
		
	})
	// 通过事件通道获取单位id
	onLoad((option) => {
		unitId.value = option.id
		serverCompanyDetail()
	})

	function serverCompanyDetail(){
		let params = {
			companyid:unitId.value
		}
		getCompanyListDetail(params).then(res => {
			if(res.code === 1){
				unitObject.value = res.data;
			}else{
				
			}
		})
	}
	function statusStr(value){
		if(value === 0){
			return '正常'
		}else if(value === 1){
			return '删除'
		}else if(value === 8){
			return '停用'
		}
	}
</script>

<style lang="scss" scoped>
	.u-page {
		padding: 0;

		&__item {
			background-color: #fff;

			&__list {
				display: flex;
				justify-content: space-between;
				margin-bottom: 10px;
				color: #797E84;
				font-size: 13px;

				&__title {
					color: #333;
					font-size: 14px;
				}
			}


			&__title {
				color: #333;
				background-color: #fff;
				padding: 15px;
				font-size: 15px;

				&__slot-title {

					font-size: 14px;
				}
			}

			&__table {
				&__item {
					display: flex;
					justify-content: space-between;
					align-items: center;
					padding: 15px;
					flex: 1;

					&__left {
						color: #797E84;
						font-size: 13px;
					}

					&__right {
						display: flex;
						justify-content: space-around;
						align-items: center;
						color: #333;
						font-size: 14px;

						&__box {
							width: 40px;
							height: 40px;

							text-align: center;

						}
					}
				}
			}
		}
	}

	.u-collapse-content {

		font-size: 14px;
	}
	.slot-content{
		font-size: 16px;
		color: #333;
		float: right;
	}
	.slot-title{
		width: 25%;
		font-size: 16px;
		color: #999;
	}
</style>